﻿''' <summary>
''' Represents a ListBox control used as a drop-down filter list
''' in a DataGridView control.
''' </summary>
Class FilterTextBox
    Inherits TextBox

    ''' <summary>
    ''' Initializes a new instance of the FilterListBox class.
    ''' </summary>
    Public Sub New()
        Visible = False
        BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        TabStop = False
    End Sub

    ''' <summary>
    ''' Indicates that the FilterListBox will handle (or ignore) all 
    ''' keystrokes that are not handled by the operating system. 
    ''' </summary>
    ''' <param name="keyData">A Keys value that represents the keyboard input.</param>
    ''' <returns>true in all cases.</returns>
    Protected Overrides Function IsInputKey(ByVal keyData As Keys) As Boolean
        Return True
    End Function

    ''' <summary>
    ''' Processes a keyboard message directly, preventing it from being
    ''' intercepted by the parent DataGridView control.
    ''' </summary>
    ''' <param name="m">A Message, passed by reference, that 
    ''' represents the window message to process.</param>
    ''' <returns>true if the message was processed by the control;
    ''' otherwise, false.</returns>
    Protected Overrides Function ProcessKeyMessage(ByRef m As Message) As Boolean
        Return ProcessKeyEventArgs(m)
    End Function

End Class 'FilterListBox